package net.valerijtimakov.homefinances.exceptions;

import net.valerijtimakov.homefinances.domain.common.CheckedData;

public class AppException extends Exception {

	private static final long serialVersionUID = 1L;
	
	private String userMessage;

	private String throwedViewId = "";
	
	public AppException() {
		super();
	}
	
	public AppException(String message) {
		super(message);
		this.userMessage = message;
	}
	
	public AppException(Throwable t) {
		super(t);
		this.userMessage = t.getMessage();
	}
	
	public AppException(String message, Throwable t) {
		super(message, t);
		this.userMessage = message;
	}
	
	public AppException(String message, Throwable t, String userMessage) {
		super(message, t);
		this.userMessage = userMessage;
	}
	
	public AppException(String message, String userMessage) {
		super(message);
		this.userMessage = userMessage;
	}

	public String getUserMessage() {
		return userMessage;
	}

	public void setUserMessage(String userMessage) {
		this.userMessage = userMessage;
	}
	
	public String getThrowedViewId() {
		return throwedViewId;
	}

	public void setThrowedViewId(String throwedViewId) {
		this.throwedViewId = CheckedData.checkNull(throwedViewId);
	}

	public String getErrorShowViewId() {
		return "/errors/error.xhtml";
	}
}
